//
//  ReservacionesCreator.m
//  Futbol5Final
//
//  Created by Ulises Ocana on 4/14/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "ReservacionesCreator.h"
#import "ReservacionVO.h"

@implementation ReservacionesCreator

-(NSMutableArray *) createReservaciones:(CanchaVO*)canchap :(NSDictionary *)reservacionesData{
    
    NSMutableArray * reservacionesResult = [[NSMutableArray alloc]init];
    
    ReservacionVO *reservacionVoTmp;
    
    NSMutableDictionary *reservacionTmp = [[NSMutableDictionary alloc]init];
    
    NSString *ids;
    
    NSEnumerator *arrenum = [reservacionesData objectEnumerator];
    id cobj;   
    
    while ( cobj = [arrenum nextObject] ) {            
        
        [reservacionTmp setDictionary:cobj];
        ids = [reservacionTmp objectForKey:@"id_reservcion"];
        
        reservacionVoTmp = [[ReservacionVO alloc]initWithData:[ids intValue] :[[reservacionTmp objectForKey:@"hora_inicio"]intValue] :[[reservacionTmp objectForKey:@"hora_fin"]intValue] :[[reservacionTmp objectForKey:@"id_dueno"]intValue] :[[reservacionTmp objectForKey:@"id_cancha"]intValue] :[reservacionTmp objectForKey:@"date"]];           
        
        [reservacionesResult addObject:reservacionVoTmp];
        
        [reservacionVoTmp release];
        [ids release];
        
    }
    
    [reservacionTmp release];
    [cobj release];
    
    return reservacionesResult;
}

@end
